// 这份文件我要导出每个api的请求
import request from './request'

// 首页数据请求(按需导出)
export const HomeApi = () => request.get("/index/index")

// 搜索窗口数据
export const PopupApi = () => request.get("/search/index")

// 实时搜索功能
// 如果是get请求,params要解构
// 如果是post请求则不需要
export const SearchHelperApi = (params) => request.get("/search/helper", { params })

// 搜索框商品搜索
export const ProductsSearchApi = (params) => request.get("/goods/list", { params })

// 清除历史记录
export const ClearHistoryApi = () => request.post("/search/clearhistory")

// 登录接口（没有账号自动注册）
export const LoginApi = (params) => request.post("/auth/loginByWeb", params)

// 产品明细
export const GoodsDetailApi = (params) => request.get("/goods/detail", { params })

// 相关产品
export const GoodsAboutApi = (params) => request.get("/goods/related", { params })

// 获取购物车产品数量(请求体)
export const CartGoodsNumApi = () => request.get("/cart/goodscount")

// 加入购物车
export const CartAddApi = (params) => request.post("/cart/add", params)

// 获取购物车数据（含完成编辑）
export const CartDataApi = () => request.get("/cart/index")

//点击切换商品选中状态（含全选）
export const GoodsSelectApi = (params) => request.post("/cart/checked", params)